package com.effective.java.chapter02;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.nio.file.FileStore;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.time.Instant;
import java.util.*;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;

public class UsingFactory01 {
    public static void main(String[] args) throws IOException {
        Date d = Date.from(Instant.now());
        System.out.println(d);

        Set<Rank> faceCards = EnumSet.of(Rank.JACK, Rank.QUEUE, Rank.KING);

        BigInteger prime = BigInteger.valueOf(Integer.MAX_VALUE);

        Object newArray = Array.newInstance(Object.class, 3);

        FileStore fs = Files.getFileStore(Paths.get("c:/"));
        System.out.println(fs.name());
        System.out.println(fs.getTotalSpace());
        System.out.println(fs.getUnallocatedSpace());

        BufferedWriter bw = Files.newBufferedWriter(Paths.get("..."));
        BufferedReader br = Files.newBufferedReader(Paths.get("d:/test/buffered.txt"));
        System.out.println(br.readLine());
        br.close();

        JarFile jfile = new JarFile("d:/test/helloworld.jar");
        List<JarEntry> litany = Collections.list(jfile.entries());
        for (JarEntry jarEntry : litany) {
            System.out.println(jarEntry.getName());
        }

    }
}
